﻿using ReNameEx.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ReNameEx.SubPage
{
    /// <summary>
    /// DeleteRulePage.xaml 的交互逻辑
    /// </summary>
    public partial class DeleteRulePage : RulePage
    {
        public DeleteRulePage()
        {
            InitializeComponent();
            ViewChange();
        }

        public override ReExRuleBase GetConfig()
        {
            return new DeleteRule()
            {
                SearchCount = SearchCount.Text.ToInt32(),
                SearchText = SearchText.Text,
                SearchMode = SearchMode.SelectedIndex
            };
        }

        private void SearchMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.IsLoaded)
                ViewChange();
        }

        private void ViewChange()
        {
            SearchText.Visibility = SearchMode.SelectedIndex == 0 ? Visibility.Collapsed : Visibility.Visible;
            SearchText_Label.Visibility = SearchMode.SelectedIndex == 0 ? Visibility.Collapsed : Visibility.Visible;
            SearchCount.Visibility = SearchMode.SelectedIndex == 0 ? Visibility.Collapsed : Visibility.Visible;
            SearchCount_Label.Visibility = SearchMode.SelectedIndex == 0 ? Visibility.Collapsed : Visibility.Visible;
        }

    }
}
